-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider/google: add failover parameter to sql database instance #14336
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than one comment on the test
local = attributes["replica_configuration.0.ca_certificate"] | ||
if instance.ReplicaConfiguration != nil { | ||
server = strconv.FormatBool(instance.ReplicaConfiguration.FailoverTarget) | ||
local = attributes["replica_configuration.0.failover_target"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need any type assertion here to make sure the value returned by attributes["replica_configuration.0.failover_target"]
is a bool? make test
passes so maybe not. Did the test run at all or are we just going to skip that for now, due to the backups thing you mention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attributes is a map[string]string, so we do strconv.FormatBool
to get the returned value as a string and then do a string comparison.
There is no test that currently sets this property (the one that looks like it would set replica configuration doesn't actually run, it's just a variable that never gets called)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad, I misread and thought server
was a string that was turned into a bool, not the other way around 😄
+ @paddycarver as a reviewer for the testing question |
local = attributes["replica_configuration.0.ca_certificate"] | ||
if instance.ReplicaConfiguration != nil { | ||
server = strconv.FormatBool(instance.ReplicaConfiguration.FailoverTarget) | ||
local = attributes["replica_configuration.0.failover_target"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad, I misread and thought server
was a string that was turned into a bool, not the other way around 😄
The code looks good to me. The test question I can't wrap my head around. I'll follow up with you in chat tomorrow, @danawillow, if that's ok? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 merge at will @danawillow
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes #11652.
I wasn't sure the best way to test this, since it looks like the only test involving replica configs so far isn't actually run, and has this comment:
Note - this test is not feasible to run unless we generate backups first.
(https://github.com/hashicorp/terraform/blob/master/builtin/providers/google/resource_sql_database_instance_test.go#L599)